//
//  UIButton+Categotry.m
//  TLUIKit
//
//  Created by c on 2021/10/27.
//

#import "UIButton+Categotry.h"

@implementation UIButton (Categotry)

+ (instancetype)buttonWithFrame:(CGRect)rect title:(NSString *)title titleColor:(UIColor *)titleColor size:(CGFloat)size weight:(UIFontWeight)weight {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitleColor:titleColor forState:0];
    btn.titleLabel.font = [UIFont systemFontOfSize:size weight:weight];
    return btn;
}

+ (instancetype)buttonWithFrame:(CGRect)rect title:(NSString *)title titleColor:(UIColor *)titleColor font:(UIFont *)font {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitleColor:titleColor forState:0];
    btn.titleLabel.font = font;
    return btn;
}

+ (instancetype)buttonWithFrame:(CGRect)rect title:(NSString *)title titleColor:(UIColor *)titleColor systemFontSize:(CGFloat)systemFontSize {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitleColor:titleColor forState:0];
    btn.titleLabel.font = [UIFont systemFontOfSize:systemFontSize];
    return btn;
}

+ (instancetype)buttonWithFrame:(CGRect)rect image:(UIImage*)image title:(NSString*)title titleColor:(UIColor*)titleColor font:(UIFont*)font {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitleColor:titleColor forState:0];
    [btn setImage:image forState:0];
    btn.titleLabel.font = font;
    return btn;
}

+ (instancetype)buttonWithFrame:(CGRect)rect backgroundImage:(UIImage*)backgroundImage title:(NSString*)title titleColor:(UIColor*)titleColor font:(UIFont*)font {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitleColor:titleColor forState:0];
    [btn setBackgroundImage:backgroundImage forState:0];
    btn.titleLabel.font = font;
    return btn;
}

+ (instancetype)buttonWithFrame:(CGRect)rect image:(UIImage*)image selectImage:(UIImage*)selectImage title:(NSString*)title selectTitle:(NSString*)selectTitle titleColor:(UIColor*)titleColor selectTitleColor:(UIColor*)selectTitleColor font:(UIFont*)font {
    UIButton *btn = [[UIButton alloc]initWithFrame:rect];
    [btn setTitle:title forState:0];
    [btn setTitle:selectTitle forState:UIControlStateSelected];
    [btn setTitleColor:titleColor forState:0];
    [btn setTitleColor:selectTitleColor forState:UIControlStateSelected];
    [btn setImage:image forState:0];
    [btn setImage:selectImage forState:UIControlStateSelected];
    btn.titleLabel.font = font;
    return btn;
}

@end
